﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace WCFServiceWebRole1
{

    [ServiceContract]

    public interface IService1
    {
        // User

        [OperationContract]

        int AddUser(string userName, string password);



        [OperationContract]

        int LoginUser(string userName, string password);

        [OperationContract]
        SUser lookupUser(string username);

        [OperationContract]
        string getUserPass(string userName);

        [OperationContract]
        Boolean changePass(string userName, string oldPass, string newPass);

        //Image
        [OperationContract]
        int AddImage(string imageURI, DateTime timeCreated,
              double Perimeter, double Area, double Diameter, double Asymmetry, double Boundary_irregularity, double Average_R,
              double Average_G, double Average_B, double Dominant_R, double Dominant_G, double Dominant_B, double Average_S, double Average_H,
              double Average_I, double Dominant_H, double Dominant_S, double Dominant_I, double Entropy, double Energy,
              double Inertia, double Homogeneity, double Number_of_subregions, double Number_of_subregion_types, Boolean benign);

        [OperationContract]
        void deleteImage(int image_id);

        [OperationContract]
        SImage getAllImageData(int image_ID);

        [OperationContract]
        void changeImageUri(int imageId, string newUri);

        //Spot
        
        [OperationContract]
        void AddImageToSpot(int spot_id, int user_id, int image_id);

        [OperationContract]
        int AddSpot(int userID, double spot_x, double spot_y, Boolean front_or_back);

        [OperationContract]
        void deleteSpot(int user_id, int spot_ID);

       [OperationContract]
        List<SSpot> getUserSpots(int user_id);

       
        [OperationContract]
        List<int> getSpotImagesIDs(int user_id, int spot_id);

        [OperationContract]
        List<SImage> getSpotImages(int user_id, int spot_id);

        [OperationContract]
        Dictionary<int, List<SImage>> getAllUserImagesPerSpot(int user_id);
    }

    [DataContract]
    public class SUser
    {
        [DataMember]
        public int UserId { get; set; }
        [DataMember]
        public string UserName { get; set; }
        [DataMember]
        public string Password { get; set; }
    }

    [DataContract]
    public class SSpot
    {
        [DataMember]
        public int spotId { get; set; }
        [DataMember]
        public double x_value { get; set; }
        [DataMember]
        public double y_value { get; set; }
        [DataMember]
        public Boolean frontORback { get; set; }   // front = true, back = false.
         [DataMember]
        public int userID { get; set; }

    }

    [DataContract]
    public class SSpotImages
    {
        [DataMember]
        public int spotID { get; set; }
        [DataMember]
        public int userID { get; set; }
        [DataMember]
        public int imageID { get; set; }
    }


    [DataContract]
    public class SImage
    {
        [DataMember]
        public int imageId { get; set; }
        [DataMember]
        public string imageUri { get; set; }
        [DataMember]
        public DateTime datecreated { get; set; }
        [DataMember]
        public double Perimeter { get; set; }
        [DataMember]
        public double Area { get; set; }
        [DataMember]
        public double Diameter { get; set; }
        [DataMember]
        public double Asymmetry { get; set; }
        [DataMember]
        public double Boundary_irregularity { get; set; }
        [DataMember]
        public double Average_R { get; set; }
        [DataMember]
        public double Average_G { get; set; }
        [DataMember]
        public double Average_B { get; set; }
        [DataMember]
        public double Dominant_R { get; set; }
        [DataMember]
        public double Dominant_G { get; set; }
        [DataMember]
        public double Dominant_B { get; set; }
        [DataMember]
        public double Average_S { get; set; }
        [DataMember]
        public double Average_H { get; set; }
        [DataMember]
        public double Average_I { get; set; }
        [DataMember]
        public double Dominant_H { get; set; }
        [DataMember]
        public double Dominant_S { get; set; }
        [DataMember]
        public double Dominant_I { get; set; }
        [DataMember]
        public double Entropy { get; set; }
        [DataMember]
        public double Energy { get; set; }
        [DataMember]
        public double Inertia { get; set; }
        [DataMember]
        public double Homogeneity { get; set; }
        [DataMember]
        public double Num_of_subregions { get; set; }
        [DataMember]
        public double Num_of_subregion_types { get; set; }
        [DataMember]
        public Boolean benign { get; set; }

    }

}
